<template lang="pug">
	.panel.panel-default
		.panel-heading 服务器列表
		table.table
			thead
				tr
					th host
					th port
					th path
			tbody
				tr(
					v-for="item in connections"
					@dblclick="GotoConnection(item._id)"
				)
					td {{ item.host }}
					td {{ item.port }}
					td {{ item.path }}
				tr
					td(colspan='3')
						a(v-link="{name: 'setting.connect'}") 添加服务器

</template>
<script>
	module.exports = {
		mixins: [
			require('mixin/rpc'),
		],
		data () {
			return {
				connections: [],
			}
		},
		created () {
			this.getAria2Servers().then(res => {
				this.connections = res.data
			})
		},
		methods: {
			GotoConnection (id) {
				this.$router.go({
					name : 'index',
					query: {
						id,
					},
				})
			},
		},
	}
</script>
